/*
 * Ext GWT 2.2.5 - Ext for GWT
 * Copyright(c) 2007-2010, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
package com.compass.ui.client.data;

import java.util.ArrayList;
import java.util.List;

import com.compass.ui.client.model.Folder;
import com.compass.ui.client.model.IndicModel;
import com.compass.ui.client.model.ScheduleEvent;
import com.compass.ui.client.model.Section;
import com.google.gwt.user.client.Random;

public class TestData {
	

	  private static final String[] months = new String[] {
	      "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

	  public static String[] getMonths() {
	    return months;
	  }

	  public static String[] getShortMonths(int n) {
	    String[] mths = new String[n];
	    for (int c = 0; c < n; c++)
	      mths[c] = months[c];
	    return mths;
	  }
	  
  public static List<IndicModel> getIndic()
  {
	  List<IndicModel> indicModel = new ArrayList<IndicModel>();
	  int line = 10;
	  for (int i = 1 ; i <= 26 ; i++)
	  {
		  int indice = Random.nextInt(200);
		  int obj	 = Random.nextInt(50);
		  int line2  = Random.nextInt(7);
		  indicModel.add(new IndicModel(i, 
				  		( indice < 100 ? indice + 100 : indice ), 
				  		( obj < 25 ? obj + 20 : obj),
				  		line,
				  		line2 + 75));
		  line += 5;
	  }
	  return indicModel;
  }
	
  public static String getRandomIndic()
  {
	  int i = Random.nextInt(3);
		switch (i) {
		case 0:
			return ("resources/images/smiley-green.jpg");
		case 1:
			return ("resources/images/smiley-orange.jpg");
		case 2:
			return ("resources/images/smiley-red.jpg");
		default:
			return ("resources/images/smiley-orange.jpg");
		}
  }
  
  public static List<TeamSales> getTeamSales() {
    List<TeamSales> teamsales = new ArrayList<TeamSales>();
    for (String m : months) {
      int upper = 50;
      int a = Random.nextInt(upper);
      int b = Random.nextInt(upper);
      int c = Random.nextInt(upper);
      teamsales.add(new TeamSales(m, a, b, c));
    }
    return teamsales;
  }
  
	public static Folder getTreeModel()
	{
	    Folder[] folders = new Folder[]{
	            new Folder("Qualité",
	                new Section[] {
	            		new Section("Q01 - Indice de qualité pièce primaire", "15/03/12", "Henry Francois"),
	            		new Section("Q02 - Qualité pièce primaire _ Défauts grave", "13/03/12", "Henry Francois"),
	            		new Section("Q03 - Indice de qualité fonctionnalité", "05/03/12", "Marcel Yves"),
	            		new Section("Q04 - Indice de qualité fonctionnalité _ Défaults grave", "10/03/12", "Marcel Yves"),
	            		new Section("Q05 - Réception pièces série", "01/03/12", "Jacques Marc"),
	            		new Section("Q06 - Défaut d'étanchéité", "14/03/12", "Tom Thierry"),
	            		new Section("Q07 - Robustesse piéce", "13/03/12", "Jérémy André"),
	            		new Section("Q08 - Nombre de pannes", "10/03/12", "Jean Claude"),
	            		new Section("Q09 - Conformité assemblage", "11/03/12", "Julien Sylvain"),
	            		new Section("Q10 - Défauts bruits", "11/03/12", "Frédéric Pascal"),
	            		new Section("Q11 - Nombre de modifications", "15/03/12", "Jérémy André"),
	            		new Section("Q12 - Nombre de plaintes clients", "?", "?"),
	            		new Section("Q13 - Indice de conformité de montage", "15/03/12", "Jérémy André"),
	            		new Section("Q14 - AMDEC", "15/03/12", "Julien Sylvain"),
	            }),
	            new Folder("Couts",
	                new Section[] {
	            		new Section("Couts", "20/03/12", "Marcel Martin"),
	    		}),
	    		new Folder("Délais",
	    			new Section[] {
	    				new Section("Délais", "20/03/12", "Thierry Martin"),
	    		}),
	    		new Folder("Prestations",
		    			new Section[] {
		    				new Section("Prestations", "20/03/12", "Jacques André"),
		    	}),
		    	new Folder("Xxxxxx",
			    		new Section[] {
			    			new Section("Xxxxxx", "20/03/12", "Robert Patrice"),
			    }),
			                           
	    };

	        Folder root = new Folder("root");
	        for (int i = 0; i < folders.length; i++) {
	          root.add((Folder) folders[i]);
	        }

	        return root;
	}
	
	public static Folder getDateTreeModel()
	{
	    Folder[] folders = new Folder[]{
	            new Folder("10/03/2012",
	                new ScheduleEvent[] {
	            		new ScheduleEvent("09:00", "Réunion"),
	            		new ScheduleEvent("11:20", "Déplacement"),
	            		new ScheduleEvent("15:00", "Conférence"),
	            }),
	            new Folder("11/03/2012",
		            new ScheduleEvent[] {
		          		new ScheduleEvent("10:30", "Déplacement"),
		          		new ScheduleEvent("14:20", "Réunion"),
		         }),
			                           
	    };

	        Folder root = new Folder("root");
	        for (int i = 0; i < folders.length; i++) {
	          root.add((Folder) folders[i]);
	        }

	        return root;
	}
}